using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[RequireComponent(typeof(BoxCollider2D))]
public class KeyToGate : MonoBehaviour
{
    [SerializeField] private Gate gate;
    private void Awake()
    {
        GetComponent<BoxCollider2D>().isTrigger = true;
    }

    private void OnTriggerEnter2D(Collider2D other)
    {
        if (other.CompareTag("Player"))
        {
            other.GetComponentInChildren<PlayerAttribute>().playerAcquireParticle.Play();
            gate.playerHasKey = true;
            Destroy(gameObject);
        }
            
    }
}
